package com.ruoyi.system.mapper;

import com.ruoyi.system.pojo.entity.Event;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.PutMapping;

import java.util.List;

public interface AgoniEventMapper {
    List<Event> listEvents();

    List<Event> getEventsByFacilityId(Long facilityId);

    int insertEvent(Event newEvent);

    List<Event> listEventsByReceiverId(Long receiverId);

    int updateReceiveEvent(@Param("eventId") Long eventId, @Param("receiverId") Long receiverId);
    @Select("SELECT * FROM agoni_event WHERE created_by = #{userId}")
    List<Event> listEventsByPublisherId(Long userId);


    @Update("UPDATE agoni_event SET status = 3 WHERE id = #{eventId}")
    int completeEvent(Long eventId);

    @Select("SELECT * FROM agoni_event WHERE created_by != #{userId} AND status = 1")
    List<Event> listEventsWithoutSelf(Long userId);
}
